# makefile

# none of these vars are actually in use yet
LOGO  = 786747-DMG.jpeg
TITLE = 5e SRD
VER   = $(shell date +%y.%m.%d)

PANDOC = $(shell which pandoc 2>/dev/null || false)
PDFTK = $(shell which pdftk 2>/dev/null || false)

# if no pdftk, then use pdf-stapler
ifeq "$(PDFTK)" ""
	PDFTK = pdf-stapler
endif

# on Slackware I use a statically compiled pandoc
# this is not a solution to not having pandoc
ifeq "$(PANDOC)" ""
	PANDOC = pandoc.static
endif

#build:
#	mkdir $@

help:
	@echo "make html     Generate book as HTML."
	@echo "make txt      Generate book as plain text."
	@echo "make epub     Generate book as an epub."
	@echo "make pdf      Generate book as an PDF."
	@echo "make clean    Remove temporary build files."
	@echo "make nuke     Remove temporary build and release files."

html:
	$(PANDOC) --from markdown \
	--to html5 \
	-o index.html \
	5e_SRD.md

pdf:
	$(PANDOC) --chapters --toc \
	5e_SRD.md \
	-H chapter_break.tex \
	-V linkcolor:blue \
	-V geometry:a4paper \
	-V geometry:margin=2cm \
	--latex-engine=xelatex \
	-o 5e_SRD.pdf
	#--lua-filter=headers.lua \

epub:
	$(PANDOC) --chapters \
	--toc 5e_SRD.md \
	-H chapter_break.tex \
	-V linkcolor:blue \
	--epub-stylesheet=epub.css \
	-o 5e_SRD.epub 
